package Work.com;

import java.util.Scanner;

public class Exam01 {
    public static boolean joinIn(String name,String password){
        String username = "kfm";
        String pass = "123456";
        return username.equals(name) && pass.equals(password);
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int count = 3;
        while (true) {
            System.out.println("请输入用户名");
            String name = sc.next();
            System.out.println("请输入密码");
            String password = sc.next();
            if (joinIn(name, password)) {
                System.out.println("登录成功");
                break;
            } else {
                count --;
                System.out.println("输入的用户名和密码有误！");
                System.out.println("剩余尝试次数" + count +"请重新输入：");
                if (count ==0) {
                    System.out.println("你的账户已被锁定");
                    break;
                }
            }
        }
    }
}
